class Animal {
    String name;
    int age;
    public Animal(String name,int age) {
        this.name = name;
        this.age = age;
    }
    public void eat() {
        System.out.println("正在吃饭");
    }
}
class Dog extends Animal{
    public Dog(String name,int age) {
        super(name,age);
    }
    public void eat() {
        System.out.println(name+"吃饭"+"年龄："+age);
    }
}

public class Test {
    public static void main(String[] args) {
        Animal animal = new Dog("旺福",3);
        animal.eat();
        if(animal instanceof Dog) {
            Dog dog = (Dog) animal;
            dog.eat();
        }
    }
}
